package cn.edu.ecut.controller;

import com.mozicoding.web.context.ParameterHolder;
import com.mozicoding.web.support.Controller;
import com.mozicoding.web.support.RequestMapping;

import javax.servlet.http.HttpSession;

@Controller( path = "/student" )
public class StudentController { // 【控制器类】

    @RequestMapping( path = "/sign/in" )
    public String signIn(ParameterHolder holder , HttpSession session ){ // 【控制器方法】
        System.out.println( "StudentController # signIn" );
        // 参数holder是个ParameterHolder类型的对象，该对象中封装了所有的来自请求的参数值
        String uname = holder.getString( "username" ) ; // <input type="text" name="username">
        String passwd = holder.getString( "password" ) ; // <input type="password" name="password" >
        System.out.println( uname + " : " + passwd );

        session.setAttribute( "studentName" , uname );

        return "/WEB-INF/success.html" ;
    }

    @RequestMapping( path = "/sign/out" )
    public String signOut(){ // 【控制器方法】
        return "" ;
    }


}